---
hide_table_of_contents: true
sidebar_label: Conversation summary buffer memory
---

# ConversationSummaryBufferMemory

`ConversationSummaryBufferMemory` combines the ideas behind [BufferMemory](/docs/modules/memory/types/buffer) and [ConversationSummaryMemory](/docs/modules/memory/types/summary).
It keeps a buffer of recent interactions in memory, but rather than just completely flushing old interactions it compiles them into a summary and uses both. Unlike the previous implementation though, it uses token length rather than number of interactions to determine when to flush interactions.

Let's first walk through how to use it:

import CodeBlock from "@theme/CodeBlock";
import TextExample from "@examples/memory/summary_buffer.ts";

import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx";

<IntegrationInstallTooltip></IntegrationInstallTooltip>

```bash npm2yarn
npm install @langchain/openai
```

<CodeBlock language="typescript">{TextExample}</CodeBlock>
